home *** CD-ROM | disk | FTP | other *** search
- /********************************************************************
- * *
- * DISKDUP *
- * *
- * オンメモリ型 DISKCOPY *
- * *
- * diskdup.exp *
- * *
- * for FM-TOWNS *
- * *
- * Copyright (c) ちにゃと & Tymic 1992. 1993. *
- * *
- * GUI ソース *
- * *
- ********************************************************************/
-
- #define __GUISUB__ /* ファイル ID */
-
- /********************************************************************
- インクルードファイル
- *********************************************************************/
-
- /* HI-C ライブラリ ヘッダー */
- #include <string.h>
-
- /* T-BIOS C ライブラリ ヘッダー */
- #include <egb.h>
- #include <mos.h>
-
- /* ソース ヘッダー */
- #include "diskdup.h"
- #include "ddupgui.h"
- #include "option.h"
-
- /********************************************************************
- 変数
- *********************************************************************/
-
- char str[60]; /* 表示文字列 バッファ */
- extern int flagerr,flagipt;
- static char work[1536]; /* EGB 関数用 ワーク */
- static char para[64]; /* EGB 関数用 パラメータ バッファ */
- static char mwork[4096]; /* MOS 関数用 ワーク */
- static int sx, sy, ex, ey; /* X Y 座標 グローバル バッファ */
-
- static char pattern[ 2 + 4*16*16/8 + 16*16/8 ] = { /* マウスパタ-ン設定 */
- 2,16,
- 0x88,0x88,0x88,0x88,0x88,0x08,0x00,0x00, /* 1 */
- 0xf8,0xff,0xff,0xff,0xff,0x08,0x00,0x00, /* 2 */
- 0xf8,0xff,0xff,0xff,0x8f,0x00,0x00,0x00, /* 3 */
- 0xf8,0xff,0xff,0xff,0x08,0x00,0x00,0x00, /* 4 */
- 0xf8,0xff,0xff,0x8f,0x00,0x00,0x00,0x00, /* 5 */
- 0xf8,0xff,0xff,0xff,0x08,0x00,0x00,0x00, /* 6 */
- 0xf8,0xff,0xff,0xff,0x8f,0x00,0x00,0x00, /* 7 */
- 0xf8,0xff,0xf8,0xff,0xff,0x08,0x00,0x00, /* 8 */
- 0xf8,0x8f,0x80,0xff,0xff,0x8f,0x00,0x00, /* 9 */
- 0xf8,0x08,0x00,0xf8,0xff,0xff,0x08,0x00, /* A */
- 0x88,0x00,0x00,0x80,0xff,0xff,0x8f,0x00, /* B */
- 0x00,0x00,0x00,0x00,0xf8,0xff,0xff,0x08, /* C */
- 0x00,0x00,0x00,0x00,0x80,0xff,0xff,0x8f, /* D */
- 0x00,0x00,0x00,0x00,0x00,0xf8,0xff,0x08, /* E */
- 0x00,0x00,0x00,0x00,0x00,0x80,0x8f,0x00, /* F */
- 0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00, /* 10 */
- 0x00,0x1f, /* 1 */
- 0x00,0x1f, /* 2 */
- 0x00,0x3f, /* 3 */
- 0x00,0x7f, /* 4 */
- 0x00,0xff, /* 5 */
- 0x00,0x7f, /* 6 */
- 0x00,0x3f, /* 7 */
- 0x00,0x1f, /* 8 */
- 0x08,0x0f, /* 9 */
- 0x1c,0x07, /* A */
- 0x3e,0x03, /* B */
- 0x7f,0x01, /* C */
- 0xff,0x80, /* D */
- 0xff,0xc1, /* E */
- 0xff,0xe3, /* F */
- 0xff,0xf7 /* 10 */
- };
-
-
- /************************************************************************
- 【スクリ-ン設定】
-
- 概要
- 用法
- 引数
- 戻り値
- 注意
- ************************************************************************/
-
- void setscreen( void )
- {
- EGB_resolution( work, 0, 0x43 ); /* 0x4* はパレットを初期化しない */
- EGB_resolution( work, 1, 0x43 );
- EGB_displayPage( work, 1, 3 ); /* 画面設定 */
- EGB_writePage( work, 1 );
- }
-
-
- /************************************************************************
- 【タイトルおよびメッセ-ジ用矩形表示】
-
- 概要
- 用法 putworkbox();
- 引数
- 戻り値
- 注意
- ************************************************************************/
-
- void putworkbox( void )
- {
- EGB_writeMode( work, 0 );
- EGB_paintMode( work, 0x22 );
- EGB_pen( work, 0 );
- EGB_color( work, 0, 8 );
- EGB_color( work, 1, 15 );
- EGB_color( work, 2, 15 );
- EGB_penSize( work, 1 );
-
- sx = SSX;
- sy = SSY;
- ex = EEX;
- ey = EEY;
- box(); /* 外枠をかく */
-
- EGB_textZoom( work, 0, 16, 16 );
- EGB_textZoom( work, 1, 16, 16 );
- EGB_textSpace( work, 3 );
- EGB_fontStyle( work, 0x01 );
- EGB_textDisplayDirection( work, 0 );
- EGB_textDirection( work, 0 );
- EGB_color( work, 0, 8 );
-
- sx = SSX + 44;
- sy = SSY + 24;
- strcpy( str, Title1 );
- putwd(); /* ソフト名を表示 */
-
- EGB_writeMode( work, 0 );
- EGB_textZoom( work, 0, 6, 12 );
- EGB_textZoom( work, 1, 12, 12 );
- EGB_textSpace( work, 1 );
- EGB_fontStyle( work, 0 );
- EGB_color( work, 0, 8 );
- EGB_color( work, 1, 15 );
- EGB_color( work, 2, 15 );
-
- sx = SSX + 40;
- sy = SSY + 48;
- strcpy( str, Title2 );
- putwd();
- }
-
-
- /************************************************************************
- 【選択】
-
- 概要
- 用法 select();
- 引数 無し
- 戻り値 int -1 : 実行選択
- 1 : 取消選択
- 注意
- ************************************************************************/
-
- int select( void )
- {
- int fg,
- sel,
- ch, x, y,
- button,
- bcount;
-
- if ( (flagipt==0) || (flagerr==1 ) )
- {
- sx = EEX - 203;
- sy = EEY - 23;
- ex = EEX - 148;
- ey = EEY - 2;
- box(); /* 『実行』と『取消』用の枠をかく。*/
-
- sx = EEX - 200;
- sy = EEY - 20;
- ex = EEX - 151;
- ey = EEY - 5;
- box(); /* 同上 */
-
- sx = EEX - 100;
- sy = EEY - 20;
- ex = EEX - 51;
- ey = EEY - 5;
- box(); /* 同上 */
-
- EGB_fontStyle( work, 0x00 );
- EGB_textZoom( work, 1, 12, 12 );
-
- sx = EEX - 190;
- sy = EEY - 7;
- strcpy( str, "実行" );
- putwd(); /* 『実行』を表示 */
-
- sx = EEX - 90;
- sy = EEY - 7;
- strcpy( str, "取消" );
- putwd(); /* 『取消』を表示 */
-
- MOS_start( mwork, 4096 );
- MOS_writePage( 1 );
- MOS_resolution( 1, 3 );
- MOS_type( 2, 0, 0, pattern );
-
- EGB_writeMode( work, 4 );
- EGB_color( work, 0, 7 );
- EGB_color( work, 1, 7 );
- EGB_color( work, 2, 7 );
-
- MOS_setpos( EEX - 162, EEY - 13 );
- MOS_disp( 1 ); /* マウス開始 */
-
- fg = 0;
- sel = 0;
- do {
- do {
- MOS_rdpos( &ch, &x, &y );
- } while ( ch != 1 );
-
- if ( y >= (EEY - 23) && y <= (EEY - 5) ) {
- if ( x > (EEX - 201) && x < (EEX - 150) && fg == 0 ) {
- MOS_disp( 0 );
- sx = EEX - 203;
- sy = EEY - 23;
- ex = EEX - 148;
- ey = EEY - 2;
- box(); /* 『実行』の枠内の反転表示 */
- MOS_disp( 1 );
- fg = 1;
- sel = -1;
- }
- else {
- if ( x > (EEX - 101) && x < (EEX - 51) && fg == 0 ) {
- MOS_disp( 0 );
- sx = EEX - 100;
- sy = EEY - 20;
- ex = EEX - 51;
- ey = EEY - 5;
- box(); /* 『取消』の枠内の反転表示 */
- MOS_disp( 1 );
- fg = 2;
- sel = 1;
- }
- else {
- fg = 0;
- }
- }
- }
- if ( fg == 1 ) {
- do {
- MOS_rdopen( 0, &button, &bcount, &x, &y );
- } while ( button == 1 );
- MOS_disp( 0 );
- sx = EEX - 203;
- sy = EEY - 23;
- ex = EEX - 148;
- ey = EEY - 2;
- box(); /* 『実行』の反転表示を元に戻す。 */
- MOS_disp( 1 );
- fg = 0;
- }
- } while ( sel == 0 );
-
- MOS_end();
- return sel;
- }
- else
- {
- return -1;
- }
- }
-
-
- /************************************************************************
- 【確認】
-
- 概要
- 用法 ready();
- 引数 無し
- 戻り値 無し
- 注意
- ************************************************************************/
-
- void ready( void )
- {
- if ( (flagipt==0) || (flagerr==1 ) )
- {
- int fg,
- sel,
- ch, x, y,
- button,
- bcount;
-
- EGB_writeMode( work, 0 );
- EGB_color( work, 0, 15 );
- EGB_color( work, 1, 15 );
- EGB_color( work, 2, 15 );
- sx = EEX - 210;
- sy = EEY - 23;
- ex = EEX - 1;
- ey = EEY - 1;
- box();
-
- EGB_color( work, 0, 8 );
- EGB_penSize( work, 1 );
- sx = EEX - 100;
- sy = EEY - 20;
- ex = EEX - 51;
- ey = EEY - 5;
- box();
-
- EGB_fontStyle( work, 0x00 );
- EGB_textZoom( work, 1, 12, 12 );
-
- sx = EEX - 90;
- sy = EEY - 7;
- strcpy( str, "確認" );
- putwd();
-
- EGB_writeMode( work, 0 );
- EGB_color( work, 0, 8 );
-
- MOS_start( mwork, 4096 );
- MOS_writePage( 1 );
- MOS_resolution( 1, 3 );
- MOS_type( 2, 0, 0, pattern );
-
- EGB_writeMode( work, 4 );
- EGB_color( work, 0, 7 );
- EGB_color( work, 1, 7 );
- EGB_color( work, 2, 7 );
-
- MOS_setpos( EEX - 62, EEY - 13 );
- MOS_disp( 1 ); /* マウス開始 */
-
- fg = 0;
- sel = 0;
- do {
- do {
- MOS_rdpos( &ch, &x, &y );
- } while ( ch != 1 );
-
- if ( y >= (EEY - 23) && y <= (EEY - 5) ) {
- if ( x > (EEX - 101) && x < (EEX - 51) && fg == 0 ) {
- MOS_disp( 0 );
- sx = EEX - 100;
- sy = EEY - 20;
- ex = EEX - 51;
- ey = EEY - 5;
- box(); /* 『確認』の枠内の反転表示 */
- MOS_disp( 1 );
- fg = 1;
- sel = -1;
- }
- }
-
- if ( fg == 1 ) {
- do {
- MOS_rdopen( 0, &button, &bcount, &x, &y );
- } while ( button == 1 );
- MOS_disp( 0 );
- sx = EEX - 100;
- sy = EEY - 20;
- ex = EEX - 51;
- ey = EEY - 5;
- box(); /* 『実行』の反転表示を元に戻す。 */
- MOS_disp( 1 );
- fg = 0;
- sel = -1;
- }
- } while ( sel == 0 );
- MOS_end();
- }
- }
-
-
- /************************************************************************
- 【中塗り矩形枠描画】
-
- 概要 塗り潰された矩形をかく。。
- 用法 box();
- 引数 無し
- 戻り値 無し
- 注意 sx, sy, ex, ey 始点と終点の X, Y 座標
- ************************************************************************/
-
- void box( void )
- {
- WORD(para+0) = sx; /* sx */
- WORD(para+2) = sy; /* sy */
- WORD(para+4) = ex; /* ex */
- WORD(para+6) = ey; /* ey */
- EGB_rectangle( work, para );
- }
-
-
- /************************************************************************
- 【文字列出力】
-
- 概要 文字列を出力する。
- 用法 putmessage();
- 引数 無し
- 戻り値 無し
- 注意 str に入っている文字列を出力
- 表示文字列は '\0' で終了していること
- ************************************************************************/
-
- void putmessage( void )
- {
- if ( (flagipt==0) || (flagerr==1 ) )
- {
- int j;
- char tmpbuf[60];
-
- EGB_writeMode( work, 0 );
- EGB_color( work, 0, 15 );
- EGB_color( work, 1, 15 );
- EGB_color( work, 2, 15 );
-
- sx = SSX + 20;
- sy = SSY + 49;
- ex = EEX - 1;
- ey = EEY - 24;
- box();
-
- EGB_writeMode( work, 0);
- EGB_color( work, 0, 8 );
- EGB_color( work, 1, 15 );
- EGB_color( work, 2, 15 );
- sx = SSX + 20;
- sy = SSY + 72;
-
- if ( ( j = strlen( str ) ) > 56 ) {
- str[56] = 0;
- }
- else {
- /* 文字列 センタリング */
- if ( ( j = ( 56 - j ) / 2 ) != 0 ) {
- strcpy( tmpbuf, str );
- memset( str, ' ', j );
- strcpy( str + j, tmpbuf );
- }
- }
-
- putwd();
- }
- }
-
- /************************************************************************
- 【文字列出力】
-
- 概要 文字列を出力する。
- 用法 putwd();
- 引数 無し
- 戻り値 無し
- 注意
- ************************************************************************/
-
- void putwd( void )
- {
- int i,
- wdlong;
-
- wdlong = strlen( str );
-
- WORD(para+0) = sx;
- WORD(para+2) = sy;
- WORD(para+4) = wdlong;
-
- for ( i = 0; i < wdlong; i++ ) {
- WORD(para + 6 + i) = str[i];
- }
-
- EGB_sjisString( work, para );
- }
-
-
- /************************************************************************
- 【文字列消去】
-
- 概要 文字列を消去する。
- 用法 clrmessage();
- 引数 無し
- 戻り値 無し
- 注意
- ************************************************************************/
-
- void clrmessage( void )
- {
- EGB_writeMode( work, 0 );
- EGB_color( work, 0, 15 );
- EGB_color( work, 1, 15 );
- EGB_color( work, 2, 15 );
-
- sx = SSX + 20;
- sy = SSY + 49;
- ex = EEX - 1;
- ey = EEY - 1;
- box();
-
- EGB_writeMode( work, 0 );
- EGB_color( work, 0, 8 );
- EGB_color( work, 1, 15 );
- EGB_color( work, 2, 15 );
- }
-
-
- /************************************************************************
- 【エラー文字列出力】
-
- 概要 エラー 文字列を出力する。
- 用法 ErrMsgPutWord( errnum );
- 引数 int errnum : エラー 文字列番号
- 戻り値 無し
- 注意 無し
- ************************************************************************/
-
- void ErrMsgPutWord( int errnum )
- {
- /* エラー 文字列出力 */
- flagerr=1;
- strcpy( str, ErrMsgTbl[errnum] );
- putmessage();
- ready();
- flagerr=0;
- }
-
-
- /* end of file */